import {Component, EventEmitter, Output} from '@angular/core';
import {UrlProvider} from "../../providers/url/url";
import {UtilsProvider} from "../../providers/utils/utils";
import {WechatProvider} from "../../providers/wechat/wechat";
import {HttpServicesProvider} from "../../providers/http-services/http-services";
import {ConfigProvider} from "../../providers/config/config";

@Component({
    selector: 'share-overlay',
    templateUrl: 'share-overlay.html'
})
export class ShareOverlayComponent {
    @Output() private outer=new EventEmitter();
    hasShow:boolean = false;
    showTitle:boolean = false;
    shareTitle:string = '餐饮信息海量发（淘鲜生餐饮圈）';
    type=1;
    constructor(
        public url: UrlProvider,
        public util: UtilsProvider,
        public wechat: WechatProvider,
        public httpService: HttpServicesProvider,
        public config: ConfigProvider
    ) {

    }
    show(){
        this.hasShow = true;
    }

    cancel(){
        this.hasShow = false;
    }

    /**
     * 打开输入标题框
     * */
    open(type){
        if(type==2){
            this.shareTitle = '快来做佣丁，餐饮任务悬赏平台（淘鲜生餐饮圈）';
        }
        this.showTitle = true;
    }

    /**
     * 关闭输入标题框
     * */
    close(){
        this.showTitle = false;
    }

    submit(){
        this.showTitle = false;
        this.show();
        this.outer.emit(this.shareTitle);
        this.shareTitle = '';
    }
}
